//
//  SCHttpManager.h
//  Shuaiche
//
//  Created by dangshuai on 2019/4/4.
//  Copyright © 2019 zzs. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "SCAppConfig.h"

static const NSInteger response_code_success = 0;
static const NSInteger response_code_unJoined_alliance = -1010304;
static const NSInteger response_code_expired = -113;//session过期
static const NSInteger response_code_invite_message_expired = -812;
static const NSInteger response_code_subscribe_message_expired = -107;
static const NSInteger response_code_alliance_dismissed = -814;
static const NSInteger response_code_verify_error = -110;//登录获取验证码用

typedef void(^HttpHandleBlock)(id responseJson, NSError *error);

@interface SCHttpManager : NSObject
+ (SCHttpManager *)shareInstance;
- (void)updateHeaderFieldSession:(id)userSession;
- (NSDictionary *)requestHeader;

/**
 * 新版本使用
 *
 * @param urlString urlPath
 * @param param     params
 * @param handleBlock   返回的有效数据
 */
- (void)httpGet:(NSString *)urlString param:(NSDictionary *)param completion:(HttpHandleBlock)handleBlock;
/**
 * 新版本使用
 *
 * @param urlString urlPath
 * @param param     params
 * @param handleBlock   返回的有效数据
 */
- (void)httpPost:(NSString *)urlString param:(NSDictionary *)param completion:(HttpHandleBlock)handleBlock;

/**
 * 新版本使用
 *
 * @param urlString urlPath
 * @param param     params
 * @param q         数据队列
 * @param handleBlock   返回的有效数据
 */
- (void)httpPost:(NSString *)urlString queue:(dispatch_queue_t)q param:(NSDictionary *)param completion:(HttpHandleBlock)handleBlock;
//验证url是否有效
- (void)httpGetUrlValid:(NSString *)urlString completion:(void(^)(BOOL valid))handleBlock;
@end

